package com.neuedu.studentmanage.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.neuedu.studentmanage.entity.DormManager;
import com.neuedu.studentmanage.entity.Pager;
import com.neuedu.studentmanage.entity.Result;
import com.neuedu.studentmanage.mapper.DormManagerMapper;
import com.neuedu.studentmanage.service.DormManagerService;

@Service
@Transactional
public class DormManagerServiceImpl implements DormManagerService {

	@Autowired
	private DormManagerMapper dMapper;

	@Override
	public List<DormManager> findListByPager(Pager<DormManager> pager) {
		return dMapper.findListByPager(pager);
	}

	@Override
	public Integer findTotalByPager(Pager<DormManager> pager) {
		return dMapper.findTotalByPager(pager);
	}

	@Override
	public Result add(DormManager object) {
		Result result = new Result(false, "新增宿管信息失败！");
		boolean ret = dMapper.add(object);
		if (ret) {
			result = new Result(true, "新增宿管信息成功！");
		}
		return result;
	}

	@Override
	public Result edit(DormManager object) {
		Result result = new Result(false, "修改宿管信息失败！");
		boolean ret = dMapper.edit(object);
		if (ret) {
			result = new Result(true, "修改宿管信息成功！");
		}
		return result;
	}

	@Override
	public Result deleteByIds(List<DormManager> ids) {
		Result result = new Result(false, "删除宿管信息失败！");
		boolean ret = dMapper.deleteByIds(ids);
		if (ret) {
			result = new Result(true, "删除宿管信息成功！");
		}
		return result;
	}

	@Override
	public List<DormManager> findAll() {
		return dMapper.findAll();
	}

}
